package com.sparrow.resource.convert.impl;

import com.sparrow.common.map.Position;
import org.springframework.core.convert.converter.Converter;

/**
 * 字符串转坐标
 * 数据模板 1,2
 */
public class PositionConvert implements Converter<String, Position> {
    @Override
    public Position convert(String source) {
        String[] split = source.split(",");
        float x = Float.parseFloat(split[0]);
        float z = Float.parseFloat(split[1]);
        return new Position(x, 0, z);
    }
}
